<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录 - 资讯聚合平台</title>
    <!-- 引入字体图标 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
    <style>
        :root {
            --primary-green: #7ED321;
            --secondary-green: #9FE870;
            --accent-yellow: #F5D544;
            --dark-gray: #2C3E50;
            --light-gray: #F8F9FA;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            background: linear-gradient(160deg, #f0f7ee 0%, #e6f3e7 100%);
            color: var(--dark-gray);
            overflow: hidden;
            position: relative;
        }

        /* 背景装饰元素 */
        .bg-shape {
            position: absolute;
            border-radius: 50%;
            z-index: -1;
        }

        .bg-shape-1 {
            top: -10%;
            left: -5%;
            width: 40vw;
            height: 40vw;
            background: linear-gradient(135deg, rgba(126, 211, 33, 0.2), rgba(159, 232, 112, 0.2));
            filter: blur(50px);
        }

        .bg-shape-2 {
            bottom: -15%;
            right: -10%;
            width: 50vw;
            height: 50vw;
            background: linear-gradient(135deg, rgba(245, 213, 68, 0.15), rgba(126, 211, 33, 0.15));
            filter: blur(60px);
        }

        .container {
            background: rgba(255, 255, 255, 0.25);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            border-radius: 30px;
            padding: 50px 40px;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.3);
            text-align: center;
            width: 100%;
            max-width: 420px;
            box-sizing: border-box;
            position: relative;
            z-index: 1;
            overflow: hidden;
        }

        .logo {
            margin-bottom: 20px;
        }

        .logo-icon {
            font-size: 3em;
            background: linear-gradient(135deg, var(--primary-green), var(--secondary-green));
            -webkit-background-clip: text;
            background-clip: text;
            -webkit-text-fill-color: transparent;
            margin-bottom: 10px;
        }

        h1 {
            color: var(--dark-gray);
            margin: 0 0 30px;
            font-size: 2.2em;
            font-weight: 600;
            letter-spacing: -0.5px;
        }

        form {
            display: flex;
            flex-direction: column;
            gap: 24px;
        }

        .form-group {
            text-align: left;
            position: relative;
        }

        label {
            display: block;
            margin-bottom: 8px;
            font-weight: 500;
            color: #4b6b5c;
            font-size: 0.95em;
        }

        .input-with-icon {
            position: relative;
        }

        .input-with-icon i {
            position: absolute;
            left: 15px;
            top: 50%;
            transform: translateY(-50%);
            color: #7a938b;
            font-size: 1.1em;
        }

        input[type="text"],
        input[type="password"] {
            width: 100%;
            padding: 15px 15px 15px 45px;
            border: 1px solid rgba(255, 255, 255, 0.4);
            border-radius: 20px;
            background: rgba(255, 255, 255, 0.5);
            color: var(--dark-gray);
            font-size: 1em;
            transition: all 0.3s ease;
            outline: none;
            box-sizing: border-box;
        }

        input[type="text"]:focus,
        input[type="password"]:focus {
            border-color: var(--primary-green);
            box-shadow: 0 0 0 4px rgba(126, 211, 33, 0.2);
            background: rgba(255, 255, 255, 0.7);
        }

        button {
            background: linear-gradient(135deg, var(--primary-green), var(--secondary-green));
            color: white;
            padding: 16px 25px;
            border: none;
            border-radius: 25px;
            font-size: 1.1em;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 6px 15px rgba(126, 211, 33, 0.3);
            margin-top: 10px;
            position: relative;
            overflow: hidden;
        }

        button::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0));
            clip-path: polygon(0 0, 100% 0, 100% 70%, 0 100%);
        }

        button:hover {
            transform: translateY(-3px);
            box-shadow: 0 8px 25px rgba(126, 211, 33, 0.5);
        }

        button:active {
            transform: translateY(-1px);
        }

        .errorlist {
            color: #e74c3c;
            list-style: none;
            padding: 0;
            margin: 5px 0 0;
            font-size: 0.9em;
            text-align: left;
        }

        .messages {
            list-style: none;
            padding: 0;
            margin-bottom: 20px;
        }

        .messages li {
            padding: 10px 15px;
            margin-bottom: 10px;
            border-radius: 15px;
            background: rgba(255, 255, 255, 0.5);
            font-size: 0.95em;
        }

        .messages li.success {
            background: rgba(126, 211, 33, 0.2);
            color: #2f4b3c;
        }

        .messages li.error {
            background: rgba(231, 76, 60, 0.2);
            color: #922b21;
        }

        .links {
            margin-top: 30px;
            font-size: 0.95em;
            display: flex;
            justify-content: space-between;
        }

        .links a {
            color: #4b6b5c;
            text-decoration: none;
            transition: color 0.3s ease;
            display: inline-flex;
            align-items: center;
        }

        .links a i {
            margin-right: 5px;
            font-size: 0.9em;
        }

        .links a:hover {
            color: var(--primary-green);
        }

        /* 自定义表单样式 */
        .helptext {
            display: none;
        }

        p {
            margin: 0;
        }
    </style>
</head>
<body>
    <!-- 背景装饰 -->
    <div class="bg-shape bg-shape-1"></div>
    <div class="bg-shape bg-shape-2"></div>

    <div class="container">
        <div class="logo">
            <div class="logo-icon">
                <i class="fas fa-newspaper"></i>
            </div>
        </div>
        <h1>欢迎回来</h1>
        
        {% if messages %}
            <ul class="messages">
                {% for message in messages %}
                    <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
                {% endfor %}
            </ul>
        {% endif %}
        
        <form method="post">
            {% csrf_token %}
            
            <div class="form-group">
                <label for="id_username">用户名</label>
                <div class="input-with-icon">
                    <i class="fas fa-user"></i>
                    <input type="text" name="username" id="id_username" required>
                </div>
                {% if form.username.errors %}
                    <ul class="errorlist">
                        {% for error in form.username.errors %}
                            <li>{{ error }}</li>
                        {% endfor %}
                    </ul>
                {% endif %}
            </div>
            
            <div class="form-group">
                <label for="id_password">密码</label>
                <div class="input-with-icon">
                    <i class="fas fa-lock"></i>
                    <input type="password" name="password" id="id_password" required>
                </div>
                {% if form.password.errors %}
                    <ul class="errorlist">
                        {% for error in form.password.errors %}
                            <li>{{ error }}</li>
                        {% endfor %}
                    </ul>
                {% endif %}
            </div>
            
            <button type="submit">登录</button>
        </form>
        
        <div class="links">
            <a href="{% url 'register' %}"><i class="fas fa-user-plus"></i> 注册新账号</a>
            <a href="#"><i class="fas fa-key"></i> 忘记密码?</a>
        </div>
    </div>
</body>
</html>
